package com.kunya.product.dao.product;

import com.kunya.product.po.Product;
import com.kunya.product.po.ProductCollection;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ProductCollectionMapper {
    int deleteByPrimaryKey(@Param("id")Integer id,@Param("table_prefix") String table_prefix);

    int insert(@Param("record") ProductCollection record,@Param("table_prefix") String table_prefix);

    int insertSelective(@Param("record") ProductCollection record,@Param("table_prefix") String table_prefix);

    ProductCollection selectByPrimaryKey(@Param("id") Integer id,@Param("table_prefix") String table_prefix);

    int updateByPrimaryKeySelective(@Param("record") ProductCollection record,@Param("table_prefix") String table_prefix);

    int updateByPrimaryKey(@Param("record") ProductCollection record,@Param("table_prefix") String table_prefix);

    //商品收藏  商品id 用户id 表前缀
    int  collectionProduct( @Param("productSpecNumber")long productSpecNumber,@Param("userId") long userId, @Param("tablePrefix")String tablePrefix);

    // 判断商品是否已收藏   返回收藏实体
    ProductCollection getCollection(@Param("productSpecNumber")long productSpecNumber, @Param("userId")long userId, @Param("tablePrefix")String tablePrefix);

    // 通过登陆用户id  查询用户收藏商品集合
    List<Product> getCollerctionProduct(@Param("userId")long userId,@Param("tablePrefix") String tablePrefix);

    //删除收藏商品  根据用户id 商品编号
    int deleteCollection(@Param("userId")long userId,@Param("productSpecNumber")long productSpecNumber,@Param("tablePrefix")String tablePrefix);





}